﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SafeHomeSystem
{
    class Surveil_system
    {
        private string type = "安全";
        private string model = "在家";
        private bool state = true;

        private Surveil_sensors[] sensors=new Surveil_sensors[5];

        public void SetModel(int i)
        {
            if (i == 0)
            {
                model = "在家";
            }
            else if (i == 1)
            {
                model = "短期外出";
            }
            else if (i == 2)
            {
                model = "长期外出";
            }
        }
        public void SetState(int i)
        {
            if (i==0)
            {
                state = true;
            }
            else 
            {
                state=false;
            }
        }


        public string GetModel()
        {
            return model;
        }
        public bool GetState()
        {
            return state;
        }
        public void Alarm()
        {
            foreach (Surveil_sensors s in sensors)
            {
                if(s.GetCondition()=="报警")
                {
                    MessageBox.Show("有紧急情况！");
                }
                if(s.GetCondition()=="异常")
                {
                    MessageBox.Show("传感器检测到异常！");
                }
            }
        }
    }
}
